import * as os from 'os';
import * as cluster from 'cluster';
const cpus = os.cpus().length;
import { NestFactory } from '@nestjs/core';
import { AppModule } from './framework/app.module';
import "./polyfills";
async function bootstrap() {
    const app = await NestFactory.create(AppModule);
    app.listen(3000).then(() => {
        console.log('app start success at port: 3000');
    });
}

if (cluster.isMaster) {
    for (let i = 0; i < cpus; i++) {
        cluster.fork();
    }
    cluster.on('exit', (worker, code, signal) => {
        console.log(`worker ${worker.process.pid} died`);
    });
} else {
    bootstrap();
}
